  <!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>

<!--父组件模板-->
<div id="app">
  <cpn></cpn>
  <cpn>
   <!--目的是获得子组件中的pLanguages-->
    <template slot-scope="slot">
    <!--  <span v-for="i in slot.data">{{i}}-</span>-->
      <span>{{slot.data.join(' - ')}}</span>
    </template>
  </cpn>
</div>

<template id="cpn">
  <div>
    <slot :data="pLanguages">
    <ul>
      <li v-for="i in pLanguages">{{i}}</li>
    </ul>
    </slot>
  </div>
</template>


<script src="../js/vue%20.js"></script>
<script>

  //父组件
  const app = new Vue({
    el:'#app',
    data:{

    },
    components: {
      cpn: {
        template: '#cpn',
        data() {
          return {
            pLanguages: ['JavaScript','Java','C++','C#','Python','Go','Swift']
          }
        }
      }
    },
    created() {
      this.pLanguages.join(' - ')
    }
  })
</script>
</body>
</html>